<template>
  <div class="facility">
    <div class="title">房屋设施</div>
    <div class="main">
      <template v-for="(item, i) in houseFacility.houseFacilitys" :key="i">
        <div class="content" v-if="houseFacility.facilitySort.includes(i)">
          <div class="top item">
            <img :src="item.icon" alt="">
            <p>{{ item.groupName }}</p>
          </div>
          <div class="right">
            <template v-for="(val, index) in item.facilitys.slice(0, 4)" :key="index">
              <div class="sonRight">
                <img src="../../../assets/img/detail/icon_check.png" alt="">
                <span>{{ val.name }}</span>
              </div>
            </template>
          </div>
        </div>
      </template>
    </div>
    <div class="footer">查看全部设施</div>
  </div>
</template>
<script setup>
const props = defineProps(['houseFacility'])
</script>
<style lang="less" scoped>
.facility {
  padding: 16px 16px 35px;
  background-color: #fff;
  position: relative;
}

.main {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 5px 0;
  border-radius: 6px;
  font-size: 12px;
  background-color: #f7f9fb;

  .item {
    margin: 20px 0;
  }
}

.title {
  font-weight: 700;
  font-size: 20px;
  color: rgb(51, 51, 51);
  text-align: justify;
  line-height: 24px;
  overflow: hidden;
  padding: 0 0 12px;
  margin-bottom: 8px;
  border-bottom: 2px solid #f7f9fb;
}

.footer {
  color: rgb(255, 150, 69);
  position: absolute;
  right: 20px;
  line-height: 44px;
  color: #ff9645;
  font-size: 14px;
  font-weight: 600;

  &::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-left: 1px solid rgb(255, 150, 69);
    border-bottom: 1px solid rgb(255, 150, 69);
    transform: rotate(223deg);
    margin-left: 8px;
  }
}

.content {
  display: flex;
  align-items: center;

  .top {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;

    img {
      width: 20px;
      height: 20px;
      margin-bottom: 7px;
    }
  }

  .right {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    // justify-content: space-around;
    margin-top: 5px;

    .sonRight {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      width: 50%;
      margin: 4px 0;
      flex-wrap: wrap;

      img {
        width: 12px;
        height: 12px;
        margin: 0 8px;
      }
    }
  }
}
</style>
